/*
 *  $Id: LightWard.cs 1055 2010-05-19 12:02:44Z thenn.erannor $
 *  This file is a part of Ragima CCG.
 *  (C) 2008-2009 Ragima development group.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Light.Spells {
    public class LightWard : SelfEnchantmentCard {
        public LightWard() : base("001_l_s_light_ward") {
            Level = CompleteLevel.ReadyForTest;
            Version = 0;
            Element = ElementType.Light;
            AdditionalElement = ElementType.Earth;
            Value = 100;
            Category = CardCategory.Ward;
            AddManaCost(Element, 2);
            AddManaCost(AdditionalElement, 2);
            AddCondition(new MeditationCondition(2, true));
        }

        protected override EnchantmentAffect CreateEnchantment() {
            return new LightWardAffect();
        }

        private static readonly Languages.CardPhrase<LightWard> EndMessage = new Languages.CardPhrase<LightWard>("end");

        private class LightWardAffect : EnchantmentAffect<LightWard> {
            public LightWardAffect() {
                Add(new Affects.WardMana(CardType.Creature));
            }

            public override void ResetAffect() {
                base.ResetAffect();
                if (IsEnded)
                    Owner.Owner.Game.Log.Add(EndMessage.Phrase);
            }
        }
    }
}
